/*! * Main.js * HTML5 Game Distribution Analytics * http://www.gamedistribution.com/ * * Creates a JavaScript HTML5 Game Distribution API that collects data from games. * * Copyright 2010-2017, Reha Biçer & Emre Demir * License: MIT * */ // Namespace var _gd_ = _gd_ || {}; // Version number _gd_.version = 'v501'; /* Statics methods */ _gd_.static = { enable: false, pingTimeOut: 30000, useSsl: false, regId: "", serverId: "", gameId: "", sVersion: "v1", initWarning: "First, you have to call 'Log' method to connect to the server.", gdApi: {}, enableDebug: false, getServerName: function () { return (this.useSsl ? "https://" : "http://") + this.regId + "." + this.serverId + ".submityourgame.com/" + this.sVersion + "/"; } }; /* Utility methods */ _gd_.utils = { encodeUrl: function (url) { return encodeURIComponent(url); //.replace(/\?/gi,'%3F').replace(/=/gi,'%3D').replace(/&/gi,'%26'); }, escapeHTML: function (s) { return s.toString().split('&').join('&').split('<').join('<').split('"').join('"'); }, absolutizeUrl: function (url) { var el = document.createElement('div'); el.innerHTML = 'x'; return el.firstChild.href; }, getScriptPath: function (scriptNames) { var i = 0, j, codePath = '', testname = '', slashPos, filenamePos, scriptUrl, scriptPath, scriptFilename, scripts = document.getElementsByTagName('script'), il = scripts.length, jl = scriptNames.length; // go through all